<?php
/**
 * @filename AppInit.php 
 * @encoding UTF-8 
 * @author 徐小军
 * @link http://www.okd100.com
 * @copyright 南昌欧科达科技有效公司 
 * @datetime 2016-7-18  13:49:43
 * @version 1.0
 * @Description
 */
namespace app\common\behavior;
use think\Request;
class AppInit
{

    public function run(&$param)
    {

        //容错处理
        error_reporting(E_ERROR | E_PARSE );
        //站点初始化
        $this->initialization();
    }

    //初始化
    private function initialization()
    {
        $request = Request::instance();
        //全局常量
        define('NOW_TIME', $_SERVER['REQUEST_TIME']);
        define('DOMAIN', $request->domain());//域名
        define('REQUEST_METHOD', $request->method());
        define('IS_GET', REQUEST_METHOD == 'GET' ? true : false);
        define('IS_POST', REQUEST_METHOD == 'POST' ? true : false);
        define('IS_AJAX', $request->isAjax());
    }

}
